Deploy All Views
๐ <ENV> - [BigQuery] Deploy all viewsโ
This GitHub Actions workflow allows developers to deploy all BigQuery views in bulk from a designated directory. It loops through each TypeScript view definition file and runs it using ts-node.
๐ Workflow Triggerโ
This workflow is triggered manually via the GitHub actions from functions repo.
๐ Environment Variablesโ
| Variable | Description | 
|---|---|
GCP_PROJECT_ID | GCP Project ID (e.g., biddirect-2) | 
๐งฑ๏ธ Workflow Job: deploy-bigquery-viewsโ
| Step | Description | 
|---|---|
| Checkout repository | Clones the GitHub repository to the runner. | 
| Set project env variable | Stores GCP_PROJECT_ID as a GitHub environment variable. | 
| Authenticate with GCP | Uses the <ENV>_BIGQUERY_ADMIN_SERVICE_ACCOUNT secret to authenticate. | 
| Set up Cloud SDK | Installs and configures the Google Cloud SDK CLI. | 
| Install dependencies | Installs Node.js dependencies in the functions directory. | 
| Deploy all BigQuery views | Loops through all .ts files in the views directory and executes each using ts-node. | 
๐งน View Scripts Directoryโ
All BigQuery view scripts must be placed in:
functions/src/bqDataLake/definitions/views/
Each .ts file should contain the logic necessary to deploy its respective view to BigQuery.
Example:
functions/src/bqDataLake/definitions/views/accounts_latest_view.ts
functions/src/bqDataLake/definitions/views/accounts_serviceUnit_latest_view.ts
๐ Required Secretsโ
| Secret Name | Description | 
|---|---|
<ENV>_BIGQUERY_ADMIN_SERVICE_ACCOUNT | Service account key JSON for GCP auth. | 
โ Example Usageโ
To run this workflow:
- Navigate to the Actions tab in your GitHub repository.
 - Select 
<ENV> - [BigQuery] Deploy all views. - Click "Run workflow".
 
This will:
- Authenticate with GCP
 - Loop through all view scripts in the target directory
 - Deploy each BigQuery view by executing its script using 
ts-node 
This workflow simplifies the process of updating all BigQuery views in development and ensures all definitions are consistently deployed.